package com.engc.common.bean;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.engc.common.utils.Constant;
import com.engc.common.utils.JDBCUtils;
import com.engc.common.utils.MessageManager;

/**
 * 
 **************************************************************** 
 * Copyright (c) 2011 –苏州埃涅加克电子信息科技有限公司 
 * Title: InitBean.java
 * Description:容器启动查询数据放入内存
 **************************************************************** 
 * 2012-12-19 V1.0
 * 
 * @author L.L
 */
public class InitBean {

	public InitBean() {

		MessageManager db = new MessageManager("db");
		String driverName = db.getMessage("db.connection.driver_class");
		String dbUrl = db.getMessage("db.connection.url");
		String dbUsername = db.getMessage("db.connection.username");
		String dbPwd = db.getMessage("db.connection.password");

		Connection basicConn = null;
		Connection assetsConn = null;
		Statement st = null;
		ResultSet rs = null;

		try {
			// 查询基础库菜单
			basicConn = JDBCUtils.getCon(driverName, dbUrl, dbUsername, dbPwd);

			st = basicConn.createStatement();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				JDBCUtils.free(rs, st, basicConn);
				JDBCUtils.free(rs, st, assetsConn);
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}

	}

}
